<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/limh/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/limh/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/limh/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/limh/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/limh/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/limh/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/limh/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="教程,">










<meta name="description" content="指向数组元素的指针和运算法则所谓指向数组元素的指针，其本质还是变量的指针。因为数组中的每个元素，其实都可以直接看成是一个变量，所以指向数组元素的指针，也就是变量的指针。 指向数组元素的指针不难，但很常用。我们用程序来解释会比较直观一些。 12unsigned char number[10] = &amp;#123;0, 1, 2, 3, 4, 5, 6, 7, 8, 9&amp;#125;;unsigned ch">
<meta name="keywords" content="教程">
<meta property="og:type" content="article">
<meta property="og:title" content="12.4、C语言指向数组元素的指针">
<meta property="og:url" content="https://tdnr.gitee.io/limh/2014/12/01/mcu079/index.html">
<meta property="og:site_name" content="土逗牛肉">
<meta property="og:description" content="指向数组元素的指针和运算法则所谓指向数组元素的指针，其本质还是变量的指针。因为数组中的每个元素，其实都可以直接看成是一个变量，所以指向数组元素的指针，也就是变量的指针。 指向数组元素的指针不难，但很常用。我们用程序来解释会比较直观一些。 12unsigned char number[10] = &amp;#123;0, 1, 2, 3, 4, 5, 6, 7, 8, 9&amp;#125;;unsigned ch">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-01-27T07:23:10.519Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="12.4、C语言指向数组元素的指针">
<meta name="twitter:description" content="指向数组元素的指针和运算法则所谓指向数组元素的指针，其本质还是变量的指针。因为数组中的每个元素，其实都可以直接看成是一个变量，所以指向数组元素的指针，也就是变量的指针。 指向数组元素的指针不难，但很常用。我们用程序来解释会比较直观一些。 12unsigned char number[10] = &amp;#123;0, 1, 2, 3, 4, 5, 6, 7, 8, 9&amp;#125;;unsigned ch">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/limh/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://tdnr.gitee.io/limh/2014/12/01/mcu079/">





  <title>12.4、C语言指向数组元素的指针 | 土逗牛肉</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans ">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/limh/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">土逗牛肉</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/limh/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/limh/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/limh/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/limh/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/limh/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tdnr.gitee.io/limh/limh/2014/12/01/mcu079/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="土逗牛肉">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/limh/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="土逗牛肉">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">12.4、C语言指向数组元素的指针</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2014-12-01T20:37:02+08:00">
                2014-12-01
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/limh/categories/单片机教程/" itemprop="url" rel="index">
                    <span itemprop="name">单片机教程</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="指向数组元素的指针和运算法则"><a href="#指向数组元素的指针和运算法则" class="headerlink" title="指向数组元素的指针和运算法则"></a>指向数组元素的指针和运算法则</h2><p>所谓指向数组元素的指针，其本质还是变量的指针。因为数组中的每个元素，其实都可以直接看成是一个变量，所以指向数组元素的指针，也就是变量的指针。</p>
<p>指向数组元素的指针不难，但很常用。我们用程序来解释会比较直观一些。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">unsigned char number[10] = &#123;0, 1, 2, 3, 4, 5, 6, 7, 8, 9&#125;;</span><br><span class="line">unsigned char *p;</span><br></pre></td></tr></table></figure>
<p>如果我们写 p = &amp;number[0];那么指针 p 就指向了 number 的第 0 号元素，也就是把number[0]的地址赋值给了 p，同理，如果写 p = &amp;number[1];p 就指向了数组 number 的第 1号元素。p = &amp;number[x];其中 x 的取值范围是 0～9，就表示 p 指向了数组 number 的第 x 号元素。指针本身，也可以进行几种简单的运算，这几种运算对于数组元素的指针来说应用最多。<br>比较运算。比较的前提是两个指针指向同种类型的对象，比如两个指针变量 p 和 q它们指向了具有同种数据类型的数组，那它们可以进行 &lt;，&gt;，&gt;=，&lt;=，==等关系运算。如果 p==q 为真的话，表示这两个指针指向的是同一个元素。<br>指针和整数可以直接进行加减运算。比如还是上边我们那个指针 p 和数组 number，如果 p = &amp;number[0]，那么 p+1 就指向了 number[1]，p+9 就指向了 number[9]。当然了，如果 p = &amp;number[9]，p-9 也就指向了 number[0]。<br>两个指针变量在一定条件下可以进行减法运算。如 p = &amp;number[0]; q = &amp;number[9];那么 q-p 的结果就是 9。但是这个地方大家要特别注意，这个 9 代表的是元素的个数，而不是真正的地址差值。如果我们的 number 的变量类型是 unsigned int 型，占 2 个字节，q-p 的结果依然是 9，因为它代表的是数组元素的个数。</p>
<p>在数组元素指针这里还有一种情况，就是数组名字其实就代表了数组元素的首地址，也就是说：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">p = &amp;number[0];</span><br><span class="line">p = number;</span><br></pre></td></tr></table></figure>
<p>这两种表达方式是等价的，因此以下几种表达形式和内容需要大家格外注意一下。</p>
<p>根据指针的运算规则，p+x 代表的是 number[x]的地址，那么 number+x 代表的也是number[x]的地址。或者说，它们指向的都是 number 数组的第 x 号元素。</p>
<p><em>(p+x)和</em>(number+x)都表示 number[x]。</p>
<p>指向数组元素的指针也可以表示成数组的形式，也就是说，允许指针变量带下标，即 p[i]和*(p+i)是等价的。但是为了避免混淆与规范起见，这里我们建议大家不要写成前者，而一律采用后者的写法。但如果看到别人那么写，也知道是怎么回事即可。</p>
<p>二维数组元素的指针和一维数组类似，需要介绍的内容不多。假如现在一个指针变量 p和一个二维数组 number[3][4]，它的地址的表达方式也就是 p=&amp;number[0][0]，有一个地方要注意，既然数组名代表了数组元素的首地址，那么也就是说 p 和 number 都是指数组的首地址。对二维数组来说，number[0]，number[1]，number[2]都可以看成是一维数组的数组名字，所以 number[0]等价于 &amp;number[0][0]， number[1]等价于 &amp;number[1][0]， number[2]等价于&amp;number[2][0]。加减运算和一维数组是类似的，不再详述。</p>
<h2 id="指向数组元素指针的实例"><a href="#指向数组元素指针的实例" class="headerlink" title="指向数组元素指针的实例"></a>指向数组元素指针的实例</h2><p>在 C 语言里边，sizeof()可以用来获取括号内的对象所占用的内存字节数，虽然它写作函数的形式，但它并不是一个函数，而是 C 语言的一个关键字，sizeof()整体在程序代码中就相当于一个常量，也就是说这个获取操作是在程序编译的时候进行的，而不是在程序运行的时候进行。这是一个实际编程中很有用的关键字，灵活运用它可以为程序带来更好的可读性、易维护性和可移植性，在后续的例程学习中将会慢慢有所体会的。</p>
<p>sizeof()括号中可以是变量名，也可以是变量类型名，其结果是等效的。而其更大的用处是与数组名搭配使用，这样可以获取整个数组占用的字节数，就不用自己动手计算了，可以避免错误，而如果日后改变了数组的维数时，也不需要再到执行代码中逐个修改，便于程序的维护和移植。</p>
<p>下面我们提供了一个简单的串口演示例程，可以体验一下指针和 sizeof()的用法。例程首先接收上位机下发的命令，根据命令值分别把不同数组的数据回发给上位机，程序还用到了指针的自增运算，也就是+1 运算，大家可以认真考虑一下指针 ptrTxd 在串口发送的过程中的指向是如何变化的。在上位机串口调试助手中分别下发 1、2、3、4，就会得到不同的数组回发，注意这里都用十六进制发送和十六进制显示。</p>
<p>此外，这个程序还应用到一个小技巧，大家要学会使用。我们前边讲了串口发送中断标志位 TI 是硬件置位，软件清零的。通常来讲，我们想一次发送多个数据的时候，就需要把第一个字节写入 SBUF，然后再等待发送中断，在后续中断中再发送剩余的数据，这样我们的数据发送过程就被拆分到了两个地方——主循环内和中断服务函数内，无疑就使得程序结构变得零散了。这个时候，为了使程序结构尽量紧凑，在启动发送的时候，不是向 SBUF 中写入第一个待发的字节，而是直接让 TI=1，注意，这时候会马上进入串口中断，因为中断标志位置 1 了，但是串口线上并没有发送任何数据，于是，我们所有的数据发送都可以在中断中进行，而不用再分为两部分了。大家可以在程序中体会一下这个技巧的好处。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;reg52.h&gt;</span><br><span class="line">bit cmdArrived = 0; //命令到达标志，即接收到上位机下发的命令</span><br><span class="line">unsigned char cmdIndex = 0; //命令索引，即与上位机约定好的数组编号</span><br><span class="line">unsigned char cntTxd = 0; //串口发送计数器</span><br><span class="line">unsigned char *ptrTxd; //串口发送指针</span><br><span class="line">unsigned char array1[1] = &#123;1&#125;;</span><br><span class="line">unsigned char array2[2] = &#123;1,2&#125;;</span><br><span class="line">unsigned char array3[4] = &#123;1,2,3,4&#125;;</span><br><span class="line">unsigned char array4[8] = &#123;1,2,3,4,5,6,7,8&#125;;</span><br><span class="line">void ConfigUART(unsigned int baud);</span><br><span class="line">void main()&#123;</span><br><span class="line">    EA = 1; //开总中断</span><br><span class="line">    ConfigUART(9600); //配置波特率为 9600</span><br><span class="line">   </span><br><span class="line">    while (1)&#123;</span><br><span class="line">        if (cmdArrived)&#123;</span><br><span class="line">            cmdArrived = 0;</span><br><span class="line">            switch (cmdIndex)&#123;</span><br><span class="line">                case 1:</span><br><span class="line">                    ptrTxd = array1; //数组 1 的首地址赋值给发送指针</span><br><span class="line">                    cntTxd = sizeof(array1); //数组 1 的长度赋值给发送计数器</span><br><span class="line">                    TI = 1; //手动方式启动发送中断，处理数据发送</span><br><span class="line">                    break;</span><br><span class="line">                case 2:</span><br><span class="line">                    ptrTxd = array2;</span><br><span class="line">                    cntTxd = sizeof(array2);</span><br><span class="line">                    TI = 1;</span><br><span class="line">                    break;</span><br><span class="line">                case 3:</span><br><span class="line">                    ptrTxd = array3;</span><br><span class="line">                    cntTxd = sizeof(array3);</span><br><span class="line">                    TI = 1;</span><br><span class="line">                    break;</span><br><span class="line">                case 4:</span><br><span class="line">                    ptrTxd = array4;</span><br><span class="line">                    cntTxd = sizeof(array4);</span><br><span class="line">                    TI = 1;</span><br><span class="line">                    break;</span><br><span class="line">                default:</span><br><span class="line">                    break;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">/* 串口配置函数，baud-通信波特率 */</span><br><span class="line">void ConfigUART(unsigned int baud)&#123;</span><br><span class="line">    SCON = 0x50; //配置串口为模式 1</span><br><span class="line">    TMOD &amp;= 0x0F; //清零 T1 的控制位</span><br><span class="line">    TMOD |= 0x20; //配置 T1 为模式 2</span><br><span class="line">    TH1 = 256 - (11059200/12/32)/baud; //计算 T1 重载值</span><br><span class="line">    TL1 = TH1; //初值等于重载值</span><br><span class="line">    ET1 = 0; //禁止 T1 中断</span><br><span class="line">    ES = 1; //使能串口中断</span><br><span class="line">    TR1 = 1; //启动 T1</span><br><span class="line">&#125;</span><br><span class="line">/* UART 中断服务函数 */</span><br><span class="line">void InterruptUART() interrupt 4&#123;</span><br><span class="line">    if (RI)&#123; //接收到字节</span><br><span class="line">        RI = 0; //清零接收中断标志位</span><br><span class="line">        cmdIndex = SBUF; //接收到的数据保存到命令索引中</span><br><span class="line">        cmdArrived = 1;//设置命令到达标志</span><br><span class="line">    &#125;</span><br><span class="line">    if (TI)&#123; //字节发送完毕</span><br><span class="line">        TI = 0; //清零发送中断标志位</span><br><span class="line">        if (cntTxd &gt; 0)&#123; //有待发送数据时，继续发送后续字节</span><br><span class="line">            SBUF = *ptrTxd; //发出指针指向的数据</span><br><span class="line">            cntTxd--; //发送计数器递减</span><br><span class="line">            ptrTxd++; //发送指针递增</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/limh/tags/教程/" rel="tag"># 教程</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/limh/2014/12/01/mcu078/" rel="next" title="12.3、C语言指针的简单示例">
                <i class="fa fa-chevron-left"></i> 12.3、C语言指针的简单示例
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/limh/2014/12/01/mcu080/" rel="prev" title="12.5、C语言字符数组和字符指针">
                12.5、C语言字符数组和字符指针 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/limh/images/avatar.jpg" alt="土逗牛肉">
            
              <p class="site-author-name" itemprop="name">土逗牛肉</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/limh/archives/">
              
                  <span class="site-state-item-count">255</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/limh/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/limh/tags/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/limhGeek" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:1591054297@qq.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/f73b243e7cc9" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-user-circle-o"></i>简书</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#指向数组元素的指针和运算法则"><span class="nav-number">1.</span> <span class="nav-text">指向数组元素的指针和运算法则</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#指向数组元素指针的实例"><span class="nav-number">2.</span> <span class="nav-text">指向数组元素指针的实例</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">土逗牛肉</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
	var str = GetUrlParam('height');
    if (str === '0'){
		document.getElementById('header').style.display = 'none';
		document.getElementById('comments').style.display = 'none';
		document.getElementById('footer').style.display = 'none';
		document.getElementsByClassName('post-footer').item(0).style.display = 'none'
	}
	
    function GetUrlParam(paraName) {
        var url = document.location.toString();
        var arrObj = url.split("?");

        if (arrObj.length > 1) {
            var arrPara = arrObj[1].split("&");
            var arr;

            for (var i = 0; i < arrPara.length; i++) {
                 arr = arrPara[i].split("=");

                if (arr != null && arr[0] === paraName) {
                    return arr[1];
                }
            }
            return "";
        } else {
            return "";
        }
    }
</script>









  












  
  
    <script type="text/javascript" src="/limh/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/limh/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/limh/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/limh/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/limh/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/limh/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
